ABC088 D - Grid Repainting
提出
code: python
from collections import deque
h, w = map(int, input().split())
que = deque(0, 0)
while (len(que)):
now = que.popleft()
go = [now0 + i, now1 + j] break
if go0 < 0 or go0 >= h or go1 < 0 or go1 >= w: continue
continue
if visited[go0][go1] == False: ans = 0
for i in range(h):
for j in range(w):
if (sij == "." and visitedij == False): ans += 1
print(ans)
解答
code: python
from collections import deque
h, w = map(int,input().split())
dis = [0 * w for _ in range(h)] que = deque(0, 0)
while que:
nowi, nowj = que.popleft()
nexti, nextj = nowi + i, nowj + j
if nexti < 0 or nexti > h-1 or nextj < 0 or nextj > w-1 or snextinextj == "#" or disnextinextj != 0: continue
else:
print(-1)
else:
sharp = 0
for i in range(h):
print(h*w - dish-1w-1 - sharp) テーマ
提出
AC/WA
code: python
from collections import deque
h, w = map(int, input().split())
que = deque(0, 0)
dis = [0 * w for _ in range(h)] while que:
nowi, nowj = que.popleft()
nexti, nextj = nowi + i, nowj + j
if nexti < 0 or nexti > h-1 or nextj < 0 or nextj > w-1 or snextinextj == "#" or disnextinextj != 0: continue
else:
if res == 0:
print(-1)
else:
visited = False * pow(10, 3) ans = 0
for i in range(h):
for j in range(w):
continue
ans += 1
else:
visited[disij - 1] = True print(ans)